package com.edu.modules.baseinfo.dao;

import com.sari.common.persistence.BaseDao;
import com.sari.common.utils.IdGen;
import org.springframework.stereotype.Repository;

/**
 * Created by lab on 2016/7/15.
 */
@Repository
public class WXDao extends BaseDao {

	public int updateTokenTicket(String token, String dateTime,String id){

		String sql = "update t_wx_token_ticket set wx_content = ?,create_time = ? where id = ?";

		return super.saveOrUpdateOrDelete(sql,token,dateTime,id);
	}

	public int saveOpenId(String openId,String parentOpenId,String createTime){

		String sql = "insert into t_wx_openid (id,open_id,parent_open_id,create_time) values (?,?,?,?)";

		return saveOrUpdateOrDelete(sql,IdGen.uuid(),openId,parentOpenId,createTime);
	}

	public String getTokenTicket(String id){

		String sql = "select wx_content from t_wx_token_ticket where id = ?";

		return getStringParma(sql,id);
	}

}
